#!/bin/bash  
macdocs='/Developer/Documentation/DocSets/' 
iosdocs='/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/' 
# Function: Extract Docs From Xar Archivesdo_extract() {  
 echo In directory: $1  
  echo Extract xars... for file in `ls -1`   
  do     
  xar -xf $file   
  done    
    
echo Delete xars...   
rm -f *.xar   
echo Change ownerships...   
for dir in `ls -1`   
do     
chown -R -P _devdocs $dir    
 
chmod 775 $dir done  
}  
# Delete Old Docs and Copy xar to Mac Doc Direcho Operation Start.  
echo  
echo Deleting Old Mac Docsets...  
rm -rf ${  
macdocs  
}  
*.docsetecho Copying xars to   
$macdocscp Mac  
/*.xar   
$macdocs  
# Delete Old Docs and Copy xar to iOS Doc Direcho Deleting Old iOS Docsets...  
rm -rf ${iosdocs}*.docset  
echo Copying xars to $iosdocs...  
cp iOS/*.xar   
$iosdocs  
 
# Goto Mac Doc Dir and Extract Docs.  
echo Start to Extract Mac Docs...  
cd $macdocsdo_extract   
$macdocs  
# Goto iOS Doc Dir and Extract Docs.  
echo Start to Extract iOS Docs...  
cd $iosdocsdo_extract   
$iosdocsecho All Done.